package com.qxzl.Controller;

import com.qxzl.model.Properties;
import com.qxzl.util.FunctionUtil;
import com.qxzl.util.StaticData;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

@Controller
public class Index {
    @Resource
    Properties properties;
    /**
     * 首页
     * @return
     */
    @RequestMapping("/")
    public String page(Model model){
        StaticData.clients.clear();
        StaticData.services.clear();
        StaticData.clients.addAll(FunctionUtil.coveClientsJson(properties.getPach()+properties.getJsonClientsName()));
        StaticData.services.addAll(FunctionUtil.coveServicesJson(properties.getPach()+properties.getJsonServiceName()));
        model.addAttribute("Clients", StaticData.clients);
        model.addAttribute("Services",StaticData.services);
        return "system/index";
    }




    /**
     *视图
     * @param model
     * @return
     */
    @RequestMapping("/model")
    public String page3(Model model){
        model.addAttribute("name","seawater");
        return "hello";
    }
}
